import java.util.Scanner;
class Mark{
    private int grade; // 定义分数
    // 进行成绩等级划分
    public void grade_division(){
        if(grade>=90&&grade<=100){
            System.out.println("该同学成绩为 "+grade+"，判定为：优秀");
        }else if(grade>=80&&grade<90){
            System.out.println("该同学成绩为 "+grade+"，判定为：优良");
        }else if(grade>=70&&grade<80){
            System.out.println("该同学成绩为 "+grade+"，判定为：良好");
        }else if(grade>=60&&grade<70){
            System.out.println("该同学成绩为 "+grade+"，判定为：合格");
        }else {
            System.out.println("该同学成绩为 "+grade+"，判定为：不合格");
        }
    }
    // get,set方法
    public int getGrade() {
        return grade;
    }

    public void setGrade(int grade) {
        this.grade = grade;
    }
}

public class Text {
    public static void main(String[] args) {
        System.out.println("输入学生的成绩：");
        while (true){
            Scanner sc = new Scanner(System.in);
            if (sc.hasNextInt()){
                int grade = sc.nextInt();
                if(grade>=0&&grade<=100){
                    Mark mark = new Mark();
                    mark.setGrade(grade);
                    mark.grade_division();
                    break;
                }

            }else {
                System.out.println("输入成绩非法，请重新输入：");
            }
        }

    }
}